package Price;

use Movie;
use Moose;
use feature qw(switch);

sub get_price_code {
	die "Must be implemented by subclass";
}

sub get_charge {
    die "Must be implemented by subclass";
}

sub get_fre_rental_points {
	return 1;
}

package Childrenprice;
use Moose;

extends 'Price';

sub get_price_code {
	return $Movie::CHILDREN;
}

sub get_charge {
	my $self = shift;
	my $days_rented = shift;
	my $result = 1;
    if ($days_rented > 3) {
        $result += ($days_rented - 3) * 1;
    }

    return $result;
}

package Newreleaseprice;
use Moose;

extends 'Price';

sub get_price_code {
	return $Movie::NEW_RELEASE;
}

sub get_charge {
	my $self = shift;
	my $days_rented = shift;

    return $days_rented * 3;
}

sub get_fre_rental_points {
	my $self = shift;
	my $days_rented = shift;

	return $days_rented > 1 ? 2 : 1;
}

package Regularprice;
use Moose;

extends 'Price';

sub get_price_code {
	return $Movie::REGULAR;
}

sub get_charge {
	my $self = shift;
	my $days_rented = shift;
	my $result = 2;
    if ($days_rented > 2) {
        $result += ($days_rented - 2) * 1;
    }

    return $result;
}


